<template>
  <div class="container" @click="handleGallary">
  <div class="wrapper">
   <swiper :options="swiperOption">
    <swiper-slide v-for="(item,index) in imgs" :key="index">
  <img :src="item" class="index_img">
    </swiper-slide>
  <div class="swiper-pagination" slot="pagination"></div>
  </swiper>
   </div>
  </div>
</template>

<script>
export default {
  name: 'CommonGallary',
  props: {
    imgs: {
      type: Array,
      default () {
        return []
      }
    }
  },
  methods: {
    handleGallary () {
      this.$emit('close')
    }
  },
  data () {
    return {
      swiperOption: {
        pagination: '.swiper-pagination',
        paginationType: 'fraction',
        observer: true, // 每次刷新一次，重新定位
        observeParents: true // observer observeParents 经常一起使用 具体看官方文档
      }
    }
  }
}
</script>

<style lang="stylus" scoped>
.container>>>.swiper-container
 overflow : inherit
.container
 display: flex
 flex-direction : column
 justify-content : center
 position : absolute
 left : 0
 right: 0
 top: 0
 bottom: 0
 background : #000
 opacity : 0.97
 z-index : 999
 .wrapper
  background : #000
  opacity : 0.97
  width: 100%
  .index_img
   width :100%
  .swiper-pagination
   color: #fff
   font-size : 1.3rem
   bottom: -1.5rem
</style>
